package com.probiz.estore.common.model.customer.base;

import java.io.Serializable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.probiz.estore.common.model.product.Product;
import com.probiz.estore.common.model.system.AppUser;
import com.probiz.estore.core.model.BaseObject;

/**
 * ReviewEligibility Base Java Bean, base class for the model, mapped directly to database table
 * 
 * Avoid changing this file if not necessary, will be overwritten. 
 *
 */
public class ReviewEligibilityTbl extends BaseObject implements Serializable {

    protected Integer reviewEligibilityId;
	protected java.util.Date expiredTime;
	protected Integer remainedCount;
	protected java.util.Date createTime;
	protected java.util.Date updateTime;
	protected AppUser customer;
	protected Product product;


	/**
	 * Default Empty Constructor for class ReviewEligibility
	 */
	public ReviewEligibilityTbl () {
		super();
	}
	
	/**
	 * Default Key Fields Constructor for class ReviewEligibility
	 */
	public ReviewEligibilityTbl (
		 Integer in_reviewEligibilityId
        ) {
		this.setReviewEligibilityId(in_reviewEligibilityId);
    }

	

	public AppUser getCustomer() {
		return customer;
	}

	public void setCustomer(AppUser customer) {
		this.customer = customer;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	/**
	 * 	 * @return Integer
     * @hibernate.id column="reviewEligibilityId" type="java.lang.Integer" generator-class="native"
	 */
	public Integer getReviewEligibilityId() {
		return this.reviewEligibilityId;
	}
	
	/**
	 * Set the reviewEligibilityId
	 */	
	public void setReviewEligibilityId(Integer aValue) {
		this.reviewEligibilityId = aValue;
	}	

	/**
	 * 	 * @return Integer
	 */
	public Integer getProductId() {
		return this.getProduct()==null?null:this.getProduct().getProductId();
	}
	
	/**
	 * Set the productId
	 */	
	public void setProductId(Integer aValue) {
	    if (aValue==null) {
	    	product = null;
	    } else {
	        product = new Product(aValue);
	        product.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
	    }
	}	

	/**
	 * 	 * @return Integer
	 */
	public Integer getCustomerId() {
		return this.getCustomer()==null?null:this.getCustomer().getAppuserId();
	}
	
	/**
	 * Set the customerId
	 */	
	public void setCustomerId(Integer aValue) {
	    if (aValue==null) {
	    	customer = null;
	    } else {
	    	customer = new com.probiz.estore.common.model.system.AppUser(aValue);
	    	customer.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
	    }
	}	

	/**
	 * 过期时间	 * @return java.util.Date
	 * @hibernate.property column="expiredTime" type="java.util.Date" length="19" not-null="false" unique="false"
	 */
	public java.util.Date getExpiredTime() {
		return this.expiredTime;
	}
	
	/**
	 * Set the expiredTime
	 */	
	public void setExpiredTime(java.util.Date aValue) {
		this.expiredTime = aValue;
	}	

	/**
	 * 剩余可评论次数	 * @return Integer
	 * @hibernate.property column="remainedCount" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getRemainedCount() {
		return this.remainedCount;
	}
	
	/**
	 * Set the remainedCount
	 */	
	public void setRemainedCount(Integer aValue) {
		this.remainedCount = aValue;
	}	

	/**
	 * 	 * @return java.util.Date
	 * @hibernate.property column="createTime" type="java.util.Date" length="19" not-null="true" unique="false"
	 */
	public java.util.Date getCreateTime() {
		return this.createTime;
	}
	
	/**
	 * Set the createTime
	 * @spring.validator type="required"
	 */	
	public void setCreateTime(java.util.Date aValue) {
		this.createTime = aValue;
	}	

	/**
	 * 	 * @return java.util.Date
	 * @hibernate.property column="updateTime" type="java.util.Date" length="19" not-null="true" unique="false"
	 */
	public java.util.Date getUpdateTime() {
		return this.updateTime;
	}
	
	/**
	 * Set the updateTime
	 * @spring.validator type="required"
	 */	
	public void setUpdateTime(java.util.Date aValue) {
		this.updateTime = aValue;
	}	

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof ReviewEligibilityTbl)) {
			return false;
		}
		ReviewEligibilityTbl rhs = (ReviewEligibilityTbl) object;
		return new EqualsBuilder()
				.append(this.reviewEligibilityId, rhs.reviewEligibilityId)
								.append(this.expiredTime, rhs.expiredTime)
				.append(this.remainedCount, rhs.remainedCount)
				.append(this.createTime, rhs.createTime)
				.append(this.updateTime, rhs.updateTime)
				.isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-82280557, -700257973)
				.append(this.reviewEligibilityId) 
								.append(this.expiredTime) 
				.append(this.remainedCount) 
				.append(this.createTime) 
				.append(this.updateTime) 
				.toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this)
				.append("reviewEligibilityId", this.reviewEligibilityId) 
								.append("expiredTime", this.expiredTime) 
				.append("remainedCount", this.remainedCount) 
				.append("createTime", this.createTime) 
				.append("updateTime", this.updateTime) 
				.toString();
	}

	/**
	 * Return the name of the first key column
	 */
	public String getFirstKeyColumnName() {
		return "reviewEligibilityId";
	}
	
	/**
	 * Return the Id (pk) of the entity, must be Integer
	 */
	public Integer getId() {
		return reviewEligibilityId;
	}

}